package Class.Regex;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegexDemo02 {
    public static void main(String[] args) {
       // compile(String regex) 将正则表达式编译到模式中
//        Pattern p = Pattern.compile("a*b");
//        //Matcher matcher(CharSequence input);
//        Matcher m=p.matcher("aaaabbbb");    //给定字符串，返回匹配器
//
//        boolean b=m.matches();  //是否匹配
//        System.out.println(b);
//        System.out.println("aaaaab".matches("a*b"));
        String s="myphone：13587984349 myname：zxx  mycompanyphone:15523622141";
        Matcher m =Pattern.compile("1[3578]\\d{9}").matcher(s);
        while(m.find()){
            System.out.println(m.group());
        }
    }
}
